#include <bits/stdc++.h>

using namespace std;

char word[10],text[1000000];
int lw,lt,first,fans,isfirst=1,cnt;
int main()
{
    gets(word);
    gets(text);
    lw = strlen(word);
    lt = strlen(text);
    for(int i=0;i<lw;i++){
        if(word[i]>='A'&&word[i]<='Z'){
            word[i]=word[i]+('a'-'A');
        }
    }
    for(int i;i<lt;i++){
        if(text[i]>='A'&&text[i]<='Z'){
            text[i] = text[i]+('a'-'A');
        }
    }

    for(int i=0;i<lt;i++){
        if(i==0||text[i-1]==' '){
            int first = i;
            while(text[i]!=' '&&i<lt){
                i++;
            }
            int last = i;
            bool ismatch = 1;
            if(lw!=last-first){
                ismatch = 0;
                continue;
            }
            for(int j=0;j<lw;j++){
                if(word[j]!=text[first+j]){
                    ismatch=0;
                    break;
                }
            }
            if(ismatch){
                cnt++;
                if(isfirst){
                    fans = first;
                    isfirst = 0;
                }
            }
        }
    }
    if(cnt==0)cout<<-1;
    else cout<<cnt<<' '<<fans;
    return 0;
}
